package com.xk.timerapp.utils;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Handler;
import android.os.Vibrator;

import com.kongzue.dialogx.DialogX;
import com.kongzue.dialogx.dialogs.MessageDialog;
import com.xk.timerapp.AlarmActivity;
import com.xk.timerapp.App;
import com.xk.timerapp.data.AlarmClock;

public class AlarmReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        String ringtoneUrl = intent.getStringExtra("ringtone_url");
        boolean shouldVibrate = intent.getBooleanExtra("should_vibrate", false);
        String playtime = intent.getStringExtra("playtime");
        int alarmTimes = intent.getIntExtra("alarmTimes", 0);
        long alarmInterval = intent.getLongExtra("alarmInterval", 0);
        Intent intent1 =new Intent(context,AlarmActivity.class);
        intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        // 然后，将之前从原始Intent中获取的数据放入新的Intent中
        intent1.putExtra("ringtone_url", ringtoneUrl);
        intent1.putExtra("should_vibrate", shouldVibrate);
        intent1.putExtra("playtime", playtime);
        intent1.putExtra("alarmTimes", alarmTimes);
        intent1.putExtra("alarmInterval", alarmInterval);
        context.startActivity(intent1);
    }



}
